Skip to content

fix(connect): handle v1 GraphService format and B5 digests for buf 1.69.0#29

Merged
onokonem merged 1 commit into
mainfrom
fix/buf-proto-update
Jun 1, 2026
Merged

fix(connect): handle v1 GraphService format and B5 digests for buf 1.69.0#29
onokonem merged 1 commit into
mainfrom
fix/buf-proto-update

Conversation

@onokonem
Copy link
Copy Markdown
Contributor

@onokonem onokonem commented Jun 1, 2026

Summary

Fixes buf dep update crash when using the proxy with buf 1.69.0+.

Buf 1.69.0 uses DigestTypeB5 as the default, which routes module API calls through v1 paths instead of v1beta1. The proxy had three issues handling v1 requests, causing a nil pointer crash, invalid UTF-8 errors, and digest verification failures.

Changes

Request format fix

ServeGraph used the v1beta1 request parser for all paths. v1 GetGraphRequest uses ResourceRef directly in field 1, while v1beta1 wraps each in GetGraphRequest_ResourceRef { ResourceRef, Registry }. Added parseGetGraphResourceRefsV1 and path-based parser selection.

Key files: internal/connect/commits_helpers.go, internal/connect/commits.go

Response format fix

v1 Graph.commits expects repeated Commit directly (no wrapper), while v1beta1 uses Graph_Commit { Commit, Registry }. Added conditional response format based on path.

Key files: internal/connect/commits.go

B5 digest computation

The v1 DigestType enum has no B4 type (only DIGEST_TYPE_B5 = 1). B5 wraps the B4 hash differently: SHA3-Shake256("shake256:" + hex(b4_hash)). Added toB5Digest() helper applied to all v1 handler paths.

Key files: internal/connect/commits.go

Verification

  • Existing unit tests pass
  • buf dep update in cyp-hardware-manager/api/proto exits with code 0
  • Generated buf.lock contains all 4 deps with correct B5 digests

Key Decisions

  • v1 and v1beta1 API paths both remain registered for backward compatibility
  • B5 digest computation assumes zero dependencies per module (matches proxy's single-module design)

@onokonem onokonem self-assigned this Jun 1, 2026
…igests

Buf 1.69.0 uses DigestTypeB5 by default, routing calls through v1 APIs
instead of v1beta1. Three issues fixed:

1. v1 GetGraphRequest uses ResourceRef directly (no wrapper) —
   added parseGetGraphResourceRefsV1 for the v1 parser path.

2. v1 Graph.commits expects repeated Commit directly, not wrapped
   in Graph_Commit { Commit, Registry } — added conditional response
   format based on path.

3. v1 DigestType has no B4 (only B5=1). B5 wraps the B4 hash:
   SHA3-Shake256('shake256:' + hex(b4_hash)) — added toB5Digest()
   helper applied to all v1 handler paths.

Fixes the nil pointer crash and digest verification failure when
running 'buf dep update' with buf 1.69.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@onokonem onokonem force-pushed the fix/buf-proto-update branch from 502e1ad to f3f9a2c Compare June 1, 2026 16:45
@onokonem onokonem merged commit 2e88320 into main Jun 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants